import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { MongooseModule } from '@nestjs/mongoose';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { UserModule } from '../user/user.module';
import jwtConfig from '../../../../../config/jwt.config';
import { JwtStrategy } from './jwt-auth.strategy';
import { userLoginList, userLoginSchema } from '../../schemas/login.schema';

@Module({
  providers: [AuthService, JwtStrategy],
  controllers: [AuthController],
  imports: [
    MongooseModule.forFeature([
      { name: userLoginList.name, schema: userLoginSchema },
    ]),
    JwtModule.register({
      secret: jwtConfig.secret,
      signOptions: { expiresIn: jwtConfig.expiresIn },
    }),
    UserModule,
  ],
})
export class AuthModule {}
